110

Beginner’s Guide to Code Algorithms

110

STEP 3 & 4—​draw arrow function continued 1

    With Selection.ShapeRange.Line

      .BeginArrowheadStyle =​ msoArrowheadNone

      .EndArrowheadStyle =​ msoArrowheadOpen

      .Weight =​ 2.75

      .Transparency =​ 0.5

      ‘color arrow

      .ForeColor.RGB =​ RGB(ArrowColor, ArrowColor, ArrowColor) ‘black

    End With

      Selection.ShapeRange.ConnectorFormat.BeginConnect ActiveSheet.

Shapes(Sheets(CurrentSheetName).Cells(i, 1).Value), FromConnection

      Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.

Shapes(“Oval-​” & i), 5

      ‘add connection from circle to 2nd box below

      End If

      ActiveSheet.Shapes.AddConnector(msoConnectorElbow, 1, 1, 1, 1).Select

      ‘format line

      ArrowColor =​ (20 +​ 5 * 1) Mod 255

      ‘ArrowColor =​ (20 +​ 5 * i) Mod 255

    With Selection.ShapeRange.Line

      .BeginArrowheadStyle =​ msoArrowheadNone

      .EndArrowheadStyle =​ msoArrowheadOpen

      .Weight =​ 2.75

        .Transparency =​ 0.5

      ‘color arrow

      .ForeColor.RGB =​ RGB(ArrowColor, ArrowColor, ArrowColor) ‘black

    End With

    Selection.ShapeRange.ZOrder msoSendToBack

    Selection.ShapeRange.Name =​ Sheets(CurrentSheetName).Cells(i, 3).Value & “<”

    If FromConnection =​ 1 Then

      Selection.ShapeRange.ConnectorFormat.BeginConnect ActiveSheet.

Shapes(“Oval-​” & i), 8

    Else

      Selection.ShapeRange.ConnectorFormat.BeginConnect ActiveSheet.

Shapes(Sheets(CurrentSheetName).Cells(i, 1).Value), FromConnection

    End If

    Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.

Shapes(Sheets(CurrentSheetName).Cells(i, 2).Value), ToConnection

‘Selection.ShapeRange.ConnectorFormat.EndConnect ActiveSheet.

Shapes(Sheets(CurrentSheetName).Cells(i, 1).Value & “/​” & i), 2

‘Selection.ShapeRange.RerouteConnections

End If

    ‘ *** the code here was to connect using connector rectangles, if required.

Currently not using rectangle

If Not OldShapeBegin And Not OldShapeEnd And FoundPair =​ 0 Then

    ActiveSheet.Shapes.AddConnector(msoConnectorElbow, 1, 1, 1, 1).Select

      ‘format line

    ‘ArrowColor =​ (20 +​ 5 * i) Mod 255

    ArrowColor =​ (20 +​ 5 * 1) Mod 255

    With Selection.ShapeRange.Line